import yaml

with open('account_config.yaml', 'r', encoding='utf-8') as f:
    _account = yaml.load(f.read(), Loader=yaml.FullLoader)


class AccountConfigException(Exception):
    pass


class UseConfig:

    def __init__(self):
        self.bot_name = None
        self.bot_biz_id = None
        self.bot_app_key = None

        secret_id = _account['secret_id']
        if secret_id is None:
            raise AccountConfigException('secret_id没有配置，请在根目录account_config.yaml中配置secret_id')
        self.secret_id = secret_id

        secret_key = _account['secret_key']
        if secret_key is None:
            raise AccountConfigException('secret_key没有配置，请在根目录account_config.yaml中配置secret_key')
        self.secret_key = secret_key

        region = _account['region']
        if region is None:
            raise AccountConfigException('region没有配置，请在根目录account_config.yaml中配置region')
        self.region = region


class UrlConfig:

    def __init__(self):
        pass


useConfig = UseConfig()
useConfig.bot_name = 'zx跨境商机'
useConfig.bot_biz_zid = '1900688194049146880'
useConfig.bot_app_key = 'Xyppmbyz'
urlConfig = UrlConfig()
